<template>
	<view class="my-container">
		<cu-custom bgColor="bg-orange">
			<block slot="content">首页</block>
		</cu-custom>
		<login v-if="token==''"></login>
		<view v-else>
			<van-dialog id="van-dialog" />
			<location></location>
			<view class="content">

				<view class="box1">
					<view class="chat" @click="chat">
						<text class="iconfont icon-pic_date myclass"></text>
						<text>碎碎念</text>
					</view>
					<view class="pay" @click="pay">
						<text class="iconfont icon-jizhang myclass"></text>
						<text>记账</text>
					</view>
					<view class="course" @click="course">
						<text class="iconfont icon-kebiao myclass"></text>
						<text>课程表</text>
					</view>
				</view>
				<view class="box2">
					<view class="countdown" @click="countdown">
						<text class="iconfont icon-daojishi myclass"></text>
						<text>倒计时</text>
					</view>
					<view class="todolist" @click="todolist">
						<text class="iconfont icon-beiwanglu myclass"></text>
						<text>备忘录</text>
					</view>
					<view class="lifething" @click="lifething">
						<text class="iconfont icon-jiankangguanli myclass"></text>
						<text>人生清单</text>
					</view>
				</view>
				<view class="box3">
					<view class="searchword" @click="searchword">
						<text class="iconfont icon-yingyu myclass"></text>
						<text>单词查询</text>
					</view>
					<view class="focused" @click="focused">
						<text class="iconfont icon-fanqie myclass"></text>
						<text>番茄专注</text>
					</view>
					<view class="more" @click="more">
						<text class="iconfont icon-gongneng myclass"></text>
						<text>更多功能</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapMutations,
		mapState
	} from 'vuex'
	import Dialog from '@/wxcomponents/@vant/weapp/dialog/dialog';
	export default {
		computed: {
			...mapState('m_user', ['token', 'userinfo']),
			...mapState('m_course', ['courseinfo'])
		},
		methods: {
			course() {
				uni.switchTab({
					url: '/pages/course/course'
				})
			},
			countdown() {
				uni.navigateTo({
					url: '/subpkg/countdown/countdown'
				})
			},
			todolist() {
				uni.navigateTo({
					url: '/subpkg/todolist/todolist'
				})
			},
			chat() {
				uni.navigateTo({
					url: '/subpkg/chat/chat'
				})
			},
			pay() {
				uni.navigateTo({
					url: '/subpkg/pay/pay'
				})
			},
			lifething() {
				uni.navigateTo({
					url: '/subpkg/lifething/lifething'
				})
			},
			searchword() {
				uni.navigateTo({
					url: '/subpkg/searchword/searchword'
				})
			},
			focused() {
				uni.navigateTo({
					url: '/subpkg/focused/focused'
				})
			},
			more() {
				
				Dialog.alert({
				  message: '更多功能正在开发中，敬请期待！',
				}).then(() => {
				  // on close
				});
			}
		}
	}
</script>

<style lang="less" scoped>
	.myclass {
		font-size: 110rpx;
	}

	.chat,
	.pay,
	.course,
	.countdown,
	.todolist,
	.lifething,
	.searchword,
	.focused,
	.more {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		margin: 20rpx;
	}

	.box1,
	.box2,
	.box3 {
		display: flex;
		align-items: center;
		justify-content: space-around;
	}
</style>